Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed issues handling empty keys + separator characters in the key #234

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

raing3
Copy link

@raing3 raing3 commented Mar 6, 2023

PR is to fix a couple of issues I encountered while trying to use this library:

  1. If you have an empty key in your JS object it disappears from the object when sorting it.
  2. If your key contains the separator string it disappears from the object when sorting it.
  3. If a "null" value is encountered in the encoded JSON an error was previously thrown (null is an object so passes through the existing if logic but then Object.keys throws).

Notes:

  • Hopefully the tests show the issues well enough.
  • Haven't had to handle interpreting escape sequences before so there may be a better way to do this, or may be something I have overlooked but tried to make the tests cover as many different odd scenarios I could think of.
  • Could be argued to be a BC breaking change as the "" character is no longer supported.

Let me know if any changes are needed to get this merged and released. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant